package com.angel.components.buttons {
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import mx.controls.Button;
	
	/** Event to execute before clicks. */
	[Event(name="beforeClick")]
	/** Event to execute after clicks. */
	[Event(name="afterClick")]
	[Bindable]
	public class XButton extends Button {

			public override function initialize():void {
				super.initialize();
				super.addEventListener(MouseEvent.CLICK, clickButtonHandler);
			}
			
			/**
			 * Click handler function.
			 * 
			 *	@param event click mouse event.
			 */
			protected function clickButtonHandler(event:MouseEvent):void {
				dispatchEvent(new Event("beforeClick"));

				dispatchEvent(new Event("afterClick"));
			}
	}
}
